home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / ViewIt™ 2.24 Shareware / FaceWare / FaceWare.rsrc / TEXT_1245_6. Minimum Code.txt < prev    next >
Text File  |  1994-04-10  |  2KB  |  65 lines

  1. 6. Minimum Code
  2.   All FaceWare modules are shipped with "example" or "demo" programs that illustrate use of the modules.  These programs have a one- or two- letter prefix that designates the associated module:  "vDemoXY" illustrates use of ViewIt, "drDemoXY" of DrawIt, "dbDemoXY" of DocuBase, etc.  ("XY" is a compiler designation defined in the "About Compilers" program).  Most such demo programs are quite small (2-4 pages) due to their use of FaceIt & ViewIt to automatically handle most menu and window events, and therefore make a good starting point for new projects.
  3.   Before you explore the vDemoXY (ViewIt) and fDemoXY (FaceIt) demo programs, it is helpful to examine a program that represents the minimum amount of code necessary to open a ViewIt window in a FaceIt-based program.  This code is presented below for the 3 major languages supported:
  4.  
  5. ‚Ä¢ Pascal
  6.  uses FaceStorLP, FaceProcLP;        {C1}
  7.  begin
  8.  fRec.uName := 'Minimum.Rsrc';       {C2}
  9.  FaceIt(nil,DoInit,0,0,0,0);         {C3}
  10.  FaceIt(nil,NewWnd,1000,1,0,0);
  11.  repeat
  12.   FaceIt(nil,DoLoop,0,0,0,0);        {C4}
  13.   if (fRec.uMenuID = 1000) then
  14.    ...
  15.  until false;
  16.  end.
  17.  
  18. ‚Ä¢ C
  19.  #include "FaceStorLC.h"             /*C1*/
  20.  void main()
  21.  {
  22.  strcpy(fRec.uName,"Minimum.Rsrc");  /*C2*/
  23.  FaceIt(0,DoInit,0,0,0,0);           /*C3*/
  24.  FaceIt(0,NewWnd,1000,1,0,0);
  25.  for (;;) {
  26.   FaceIt(0,DoLoop,0,0,0,0);          /*C4*/
  27.   if (fRec.uMenuID == 1000)
  28.    ...
  29.   }
  30.  }
  31.  
  32. ‚Ä¢ C++
  33.  #include "FaceStorSC.h"             /*C1*/
  34.  void main()
  35.  {
  36.  strcpy(fRec.uName,"Minimum.Rsrc");  /*C2*/
  37.  FaceIt(0,DoInit);                   /*C3*/
  38.  FaceIt(0,NewWnd,1000,1);
  39.  for (;;) {
  40.   FaceIt(0,DoLoop);                  /*C4*/
  41.   if (fRec.uMenuID == 1000)
  42.    ...
  43.   }
  44.  }
  45.  
  46. ‚Ä¢ FORTRAN
  47.  include FaceStorLF.inc              !C1
  48.  record /FaceRec/ fRec
  49.  common/FaceStuff/fRec
  50.  fRec.uName = 'Minimum.Rsrc'         !C2
  51.  FaceIt(0,DoInit,0,0,0,0)            !C3
  52.  FaceIt(0,NewWnd,1000,1,0,0)
  53.  do while (.true.)
  54.   FaceIt(0,DoLoop,0,0,0,0)           !C4
  55.   if (fRec.uMenuID = 1000) then
  56.    ...
  57.  end do
  58.  end
  59.  
  60. The "C#" comments refer to later help topics that describe what the associated code is doing:
  61.   C1 = see Include Files topic
  62.   C2 = see Resource Files topic
  63.   C3 = see Initializations topic
  64.   C4 = see Event Handling topic
  65. Please take the time to read these topics so that you have a good idea why FaceIt-based programs are built around these four elements.